<template>
  <div style="app">
    <index-page />
  </div>
</template>

<script>
import IndexPage from './views/index/index.vue'
import {checkToken} from '@/api/wechat';
import store from '@/store';
export default {
  name: 'App',
  components: {
    IndexPage
  },
  data() {
    return {
      //刷新token锁
      refreshLock: false,
      refreshTime: '',
      //刷新token的时间
    }
  },
  created() {
    //实时检测刷新token
    if (store.getters.token){
      this.refreshToken()
    }
  },
  methods: {
    refreshToken() {
      this.refreshTime = setInterval(() => {
        store.dispatch("CheckToken");
      }, 5*1000)
    },
  }
}
</script>

<style>
  .app {
    text-align: center;
  }
</style>
